import * as tslib_1 from "tslib";
import { observable, action } from "mobx";
import request from "../utils/request";
import * as api from "../api/api";
import { LoadHoc, loading } from "../hoc/loadHoc";
let DynamicStore = class DynamicStore extends LoadHoc {
  constructor() {
    super(...arguments);
    /**
     * 动态列表
     */
    this.allDynamic = {};
    /**
     * 动态详情
     *
     */
    this.dynamicInfo = {};
    /**
     * 动态分类
     * GET /api/services/app/dynamicType/GetAllDynamicType
     */
    this.allDynamicType = {};
  }
  async getAllDynamic(params) {
    const { dynamicType, pageIndex, pageSize, callback } = params;
    const allDynamic = await request(api.AppdynamicApiFetchParamCreactor.appdynamicGetAllDynamicAsync({
      formDynamicType: dynamicType,
      formSkipCount: (pageIndex - 1) * pageSize,
      formMaxResultCount: pageSize
    }));
    this.allDynamic = allDynamic;
    callback && callback(allDynamic);
  }
  async getDynamicInfo(params) {
    const { id, callback } = params;
    const dynamicInfo = await request(api.AppdynamicApiFetchParamCreactor.appdynamicGetDynamicInfoAsync({
      formId: id
    }));
    this.dynamicInfo = dynamicInfo;
    callback && callback(dynamicInfo);
  }
  async getAllDynamicType(params) {
    const { keyWorlds, callback } = params;
    const allDynamicType = await request(api.AppdynamicTypeApiFetchParamCreactor.appdynamicTypeGetAllDynamicTypeAsync({
      formKeyWorlds: keyWorlds
    }));
    this.allDynamicType = allDynamicType;
    callback && callback(allDynamicType);
  }
};
export { DynamicStore as default };

tslib_1.__decorate([observable], DynamicStore.prototype, "allDynamic", undefined);
tslib_1.__decorate([loading, action], DynamicStore.prototype, "getAllDynamic", null);
tslib_1.__decorate([observable], DynamicStore.prototype, "dynamicInfo", undefined);
tslib_1.__decorate([loading, action], DynamicStore.prototype, "getDynamicInfo", null);
tslib_1.__decorate([observable], DynamicStore.prototype, "allDynamicType", undefined);
tslib_1.__decorate([loading, action], DynamicStore.prototype, "getAllDynamicType", null);